package edu.nf.postlikework.controller.app;

import edu.nf.postlikework.controller.BaseController;
import edu.nf.postlikework.model.entity.User;
import edu.nf.postlikework.result.ResultVo;
import edu.nf.postlikework.service.UserService;
import jakarta.servlet.http.HttpSession;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author zjl
 * @date 2025/10/13
 */
@RestController
@RequiredArgsConstructor
public class UserController extends BaseController {
    private final UserService  userService;

    @GetMapping("/user/login")
    public ResultVo<?> login(String userName, HttpSession session) {
        User user = userService.getUser(userName);
        session.setAttribute("user", user);
        return success();
    }
}
